<?php
namespace app\admin\model;


class ProgramModel extends BaseModel
{
    protected $table = 'sf_program';
    public function getUidAttr($data){
        $user = new UserModel();
        $user = $user->where(['id'=>$data])->find();
        return $user['mobile'];
    }
    public function like_num(){
        return $this->hasMany('ProgramLikeModel','message_id','id');
    }
    public function comment_num(){
        return $this->hasMany('ProgramCommentModel','message_id','id');
    }
    public function getAddTimeAttr($data){
        return date('Y-m-d H:i:s',$data);
    }
    public function getUpdateTimeAttr($data){
        return date('Y-m-d H:i:s',$data);
    }
    public function getDetailAttr($data){
        return htmlspecialchars_decode($data);
    }
}
